package com.tchhy.provider.service.partner.impl

import com.tchhy.provider.data.partner.MedicineKitApplyInfo
import com.tchhy.provider.data.partner.MedicineRequestModel
import com.tchhy.provider.repository.CommonRepository
import com.tchhy.provider.repository.partner.WorkRepository
import com.tchhy.provider.service.partner.WorkService
import com.tchhy.provider.data.common.BaseResp
import com.tchhy.provider.data.common.EmptyResp
import com.tchhy.provider.data.partner.request.ApprovalResultReq
import com.tchhy.provider.data.partner.request.SubmitChaseInfo
import com.tchhy.provider.data.partner.response.ApplyMedicineRes
import com.tchhy.provider.data.partner.response.ApprovalItemRes
import com.tchhy.provider.data.partner.response.DataListRes
import com.tchhy.provider.data.partner.response.PartnerAreaRes
import io.reactivex.Observable

/**
 * @author: admin
 * @date: 2019/8/20
 * @des:
 *
 **/
class WorkServiceIml : WorkService {

    private val commonRepository by lazy { CommonRepository() }
    private val workRepository by lazy { WorkRepository() }

    /**
     * @description 获取审批列表
     * @param
     * @return
     * @author admin
     * @time 2019/8/20
     */
    override fun getApprovalList(
        pageNum: Int,
        pageSize: Int,
        status: Int
    ): Observable<BaseResp<DataListRes<ApprovalItemRes>>> {
        return workRepository.getApprovalList(pageNum, pageSize, status)
    }

    /**
     * @description 获取审批列表
     * @param
     * @return
     * @author admin
     * @time 2019/8/20
     */
    override fun approvalMedicineApply(approvalResultReq: ApprovalResultReq): Observable<EmptyResp> {
        return workRepository.approvalMedicineApply(approvalResultReq)
    }



    override fun submitPurchaserInfo(submitChaseInfo: SubmitChaseInfo): Observable<EmptyResp> {
        return workRepository.submitPurchaserInfo(submitChaseInfo)
    }


    /**
     * @description 申请药箱数量
     * @param
     * @return
     * @author admin
     * @time 2019/8/20
     */
    override fun medicineAcount(accout: String): Observable<BaseResp<MedicineKitApplyInfo>> {
        return commonRepository.getMedicineKitApplyAccount(MedicineRequestModel(medicineChest = accout))
    }

    /**
     * @description 获取合伙人区域
     * @param
     * @return
     * @author admin
     * @time 2019/8/20
     */
    override fun getPartnerArea(): Observable<BaseResp<PartnerAreaRes>> {
        return workRepository.getPartnerArea()
    }


    /**
     * @description 获取申请列表
     * @param
     * @return
     * @author admin
     * @time 2019/8/20
     */
    override fun fetchApplyMedicineList(
        pageNum: Int,
        pageSize: Int
    ): Observable<BaseResp<DataListRes<ApplyMedicineRes>>> {
        return workRepository.fetchApplyMedicineList(pageNum, pageSize)
    }


}